package com.mavenq.fly.test;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;

public class FunctionInterface {
    BiConsumer<Integer, Integer> consumer = (a, b) -> {
        System.out.println(a + b);
    };


    @Test
    public void TestBiConsumer() {
        boolean flag = false;
        if (new Random().nextInt(2) == 1) {
            flag = true;
        }
        List<Object> a = new ArrayList<>();
        a.add(1);
        a.add("dd");
        List<Object> b = new ArrayList<>();
        boolean finalFlag = flag;
        a.stream().forEach(item -> {
            b.add(finalFlag);
        });
        System.out.println(flag);
    }

    public Integer get(BiConsumer<String, String> bi) {
        bi.accept("a", "b");
        return 1;
    }
}
